#! /usr/bin/perl
use strict;
use warnings FATAL => 'all';
use utf8;

sub total {
    my $total;
    foreach (@_) {
        chomp($_);
        $total += $_;
    }
    $total;
}

my @nums = 1 .. 1000;
print "sum: " . &total(@nums)

